
layui.config({
    version:'1510164124181'
}).use(['form', 'laypage', 'layer', 'element'],function(){
    form = layui.form;
    layer = layui.layer;
    $ = layui.jquery;
    laypage = layui.laypage;//分页
    element = layui.element; //元素操作

    SelectProInfo();

});

function ExprotExcel() {
    let LogisticePro=$(".LogisticePro").val();
    window.location.href=httpurl+"/ExprotOrderProList?ajaxHttp="+LogisticePro;
}

function SelectProInfo() {
    let LogisticePro=$(".LogisticePro").val();
    $("#tableInfo tbody").html("");
    $.ajax({
        url: httpurl+"/"+LogisticePro,
        cache: false,
        data:{
            "page":pageNo,
            "pagesize":pageRecords,
        },
        headers: {
            "Access-Control-Allow-Origin": "*",
            "Access-Control-Allow-Methods": "*",
            "Access-Control-Allow-Headers": "Authorization",
            "Authorization": GetTokenInfo()
        },
        contentType : 'application/json',
        success: function(data) {
            let dataHtml="";
            if(data.rtnCode==200){
                let initdata=data.data;
                if(initdata.length>0){

                    totalRecords =initdata[initdata.length-1].total;
                    for(let i=0;i<initdata.length;i++){

                        dataHtml+='<tr class="text-primary">'+
                            '<td class="width20"><img width="70%" src="'+visitimgurl+'/'+(initdata[i].productEntity==null?"":initdata[i].productEntity.headimg)+'"></>'+
                            '<td>'+(initdata[i].productEntity==null?"":initdata[i].productEntity.title)+'</td>'+
                            '<td>'+initdata[i].num+'</td>'+
                            '<td>'+initdata[i].money+'</td>'+
                            '</tr>';
                    }
                }else{
                    totalRecords=0;
                    dataHtml += '<tr>'
                        +'<td colspan="12" style="text-align:center;">暂无数据</td>'
                        +'</tr>';
                }

            }else{
                totalRecords=0;
                dataHtml += '<tr>'
                    +'<td colspan="12" style="text-align:center;">暂无数据</td>'
                    +'</tr>';
            }
            $("#tableInfo tbody").html(dataHtml);
            layer.closeAll();
            // page();
        }
    });
}


function SearchInfo(){
    pageNo=1;
    SelectProInfo();
}

//分页
function page(){
    laypage.render({
        elem: 'page' //注意，这里的 test1 是 ID，不用加 # 号
        ,count:totalRecords //数据总数，从服务端得到
        ,curr: pageNo //获取起始页 location.hash.replace('#!fenye=', '')
        ,hash: 'fenye' //自定义hash值
        ,layout: ['count', 'prev', 'page', 'next', 'skip']
        ,limit:pageRecords
        ,jump: function(obj, first){
            //首次不执行
            if(!first){
                pageNo = obj.curr;
                pageRecords = obj.limit;// 当前页面记录数
                inituserdata();
            }
        }
    });
}
